package com.publish.file.service.auth;

import java.util.Collection;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;

public class SimpleAuthentication implements Authentication {

	private String uname;
	private String credentials;
	private UserRoleDetail principal;
	private Object details;
	private boolean isAuthenticated = true;

	public SimpleAuthentication(String uname, String credentials, UserRoleDetail principal, Object details) {
		super();
		this.uname = uname;
		this.credentials = credentials;
		this.principal = principal;
		this.details = details;
	}

	@Override
	public String getName() {
		return uname;
	}

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		return principal.getAuthorities();
	}

	@Override
	public Object getCredentials() {
		return credentials;
	}

	@Override
	public Object getDetails() {
		return details;
	}

	@Override
	public Object getPrincipal() {
		return principal;
	}

	@Override
	public boolean isAuthenticated() {
		return isAuthenticated;
	}

	@Override
	public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
		this.isAuthenticated = isAuthenticated;
	}

}
